<template>
  <!-- <div>数据治理</div> -->
  <a-card>
    <a-form-model ref="ruleForm" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
        <a-row style="display:flex;width:100%">
            <a-card style="width:40%;margin-bottom: 60px;" >
                <h1 style="font-size:20px;font-weight:bold">互联网挖掘</h1>
                <a-form-model-item label="数据来源"  :wrapper-col="{ span: 10 }" class="bottomclear">
                    <a-radio>kafka消息队列</a-radio>
                </a-form-model-item>
                <a-form-model-item label="同步策略" :wrapper-col="{ span: 10}" class="bottomclear">
                    <a-radio-group v-model="form.kafkaType" name="radioGroup">
                        <a-radio :value="1">
                            推送
                        </a-radio>
                        <a-radio :value="2">
                            拉取
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
                <a-form-model-item label="同步周期" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio-group v-model="form.kafkaPeriod" >
                        <a-radio :value="1">
                            实时
                        </a-radio>
                        <a-radio :value="2">
                            每15分钟
                        </a-radio>
                        <a-radio :value="3">
                            每半小时
                        </a-radio>
                        <a-radio :value="4">
                            每一小时
                        </a-radio>
                        <a-radio :value="5">
                            每天
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
                <a-form-model-item label="同步通道" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio-group v-model="form.kafkaAccess" >
                        <a-radio :value="1">
                            单进程
                        </a-radio>
                        <a-radio :value="2">
                            2进程
                        </a-radio>
                        <a-radio :value="3">
                            4进程
                        </a-radio>
                        <a-radio :value="4">
                            8进程
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
            </a-card>
            <a-card style="width:40%;margin-left: 10%;margin-bottom: 60px;" >
                <h1 style="font-size:20px;font-weight:bold">人工智能挖掘</h1>
                <a-form-model-item label="数据来源" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio>SFTP文件</a-radio>
                </a-form-model-item>
                <a-form-model-item label="同步策略" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio-group v-model="form.sftpType" >
                        <a-radio :value="1">
                            推送
                        </a-radio>
                        <a-radio :value="2">
                            拉取
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
                <a-form-model-item label="同步周期" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio-group v-model="form.sftpPeriod" >
                        <a-radio :value="1">
                            实时
                        </a-radio>
                        <a-radio :value="2">
                            每15分钟
                        </a-radio>
                        <a-radio :value="3">
                            每半小时
                        </a-radio>
                        <a-radio :value="4">
                            每一小时
                        </a-radio>
                        <a-radio :value="5">
                            每天
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
                <a-form-model-item label="同步通道" :wrapper-col="{ span: 21}" class="bottomclear">
                    <a-radio-group v-model="form.sftpAccess" >
                        <a-radio :value="1">
                            单进程
                        </a-radio>
                        <a-radio :value="2">
                            2进程
                        </a-radio>
                        <a-radio :value="3">
                            4进程
                        </a-radio>
                        <a-radio :value="4">
                            8进程
                        </a-radio>
                    </a-radio-group>
                </a-form-model-item>
            </a-card>
        </a-row>
        <a-form-model-item label="同一天数据排重">
            <a-radio-group v-model="form.dataDisplacement" >
                        <a-radio :value="1">
                            是
                        </a-radio>
                        <a-radio :value="2">
                            否
                        </a-radio>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="清除非法字符">
            <a-input v-model="form.clearCharacter"/>
        </a-form-model-item>
        <a-form-model-item label="时间格式">
            <a-input v-model="form.timeFormat"/>
        </a-form-model-item>
        <a-form-model-item label="转换二级域名">
            <a-radio-group v-model="form.converDomain" >
                        <a-radio :value="1">
                            是
                        </a-radio>
                        <a-radio :value="2">
                            否
                        </a-radio>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="转换IP">
            <a-radio-group v-model="form.converIp" >
                        <a-radio :value="1">
                            是
                        </a-radio>Source
                        <a-radio :value="2">
                            否
                        </a-radio>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="数据加载方式" :wrapper-col="{ span: 21}">
            <a-radio-group v-model="form.dataLoadWay" >
                        <a-radio :value="1">
                            全量加载
                        </a-radio>
                        <a-radio :value="2">
                            增量加载
                        </a-radio>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="数据提交方式" :wrapper-col="{ span: 6}">
            <a-radio-group v-model="form.dataSubmitWay" style="display:flex">
                        <a-radio :value="1">
                            全量提交
                        </a-radio>
                        <a-radio :value="2">
                            批量提交
                        </a-radio>
                        <div v-if="form.dataSubmitWay == 2">
                            批量提交 <a-input style="width:40%;margin:0 5px" /> 条
                        </div>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="推送方式" :wrapper-col="{ span: 21}">
            <a-radio-group v-model="form.pushWay" >
                        <a-radio :value="1">
                            kafka消息队列
                        </a-radio>
                        <a-radio :value="2">
                            SFTP文件
                        </a-radio>
                        <a-radio :value="3">
                            涉诈网址上报
                        </a-radio>
            </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="同步策略">
            <a-radio-group v-model="form.pushStrategy" >
                        <a-radio :value="1">
                            推送
                        </a-radio>
                        <a-radio :value="2">
                            拉取
                        </a-radio>
                    </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="同步周期" :wrapper-col="{ span: 21}">
            <a-radio-group v-model="form.pushPeriod" >
                        <a-radio :value="1">
                            实时
                        </a-radio>
                        <a-radio :value="2">
                            每15分钟
                        </a-radio>
                        <a-radio :value="3">
                            每半小时
                        </a-radio>
                        <a-radio :value="4">
                            每一小时
                        </a-radio>
                        <a-radio :value="5">
                            每天
                        </a-radio>
                    </a-radio-group>
        </a-form-model-item>
        <a-form-model-item label="同步通道" :wrapper-col="{ span: 21}">
            <a-radio-group v-model="form.pushAccess" >
                        <a-radio :value="1">
                            单进程
                        </a-radio>
                        <a-radio :value="2">
                            2进程
                        </a-radio>
                        <a-radio :value="3">
                            4进程
                        </a-radio>
                        <a-radio :value="4">
                            8进程
                        </a-radio>
                    </a-radio-group>
        </a-form-model-item>
    </a-form-model>
    <div style="margin-left:40%;margin-bottom: 10%;">
        <a-button style="margin-right:60px" type="primary" @click="save">保存</a-button>
        <a-button type="primary" @click="remake">重置</a-button>
    </div>
  </a-card>
</template>

<script>
import { getBlockingBusinessData,saveBlockingBusinessData} from '@/api/plugging/Police'
export default {
mounted () {
    this.getData()
},
data () {
    return {
        labelCol: { span: 3 },
        wrapperCol: { span: 5 },
        loading: false,
        form:{}
    }
},
methods: {
    remake(){
        this.form = {}
    },
    save(){
        saveBlockingBusinessData(this.form).then( res => {
                if (res.success) {
                  this.$message.success(res.message)
                  this.form = {}
                  location.reload()
                  // this.onQuery()
                } else {
                  this.$message.success(res.message)
                  this.loading = false
                }
                })
                .catch((e) => {
                  this.loading = false
                  this.$message.warn('请求失败！')
                })
    },
    getData(){
        getBlockingBusinessData().then( res => {
                if (res.success) {
                  this.form = res.result
                  for(let key in this.form){
                        this.form[key] = Number(this.form[key])
                  }
                  // this.onQuery()
                } else {
                  this.$message.success(res.message)
                  this.loading = false
                }
                })
                .catch((e) => {
                  this.loading = false
                  this.$message.warn('请求失败！')
                })
    }
}
}
</script>

<style lang="less" scoped>
// /deep/.ant-form-item{
//     margin-bottom: 10px;
// }
.bottomclear{
    margin-bottom: 0px;
}
</style>